﻿@model List<AntUnion.FrameWork.Model.Models.Mt5User>
@{
    ViewData["Title"] = "Index";
    Layout = "~/Areas/Console/Views/Shared/_Layout.cshtml";
}
@section head{
    <script type="text/javascript">
        var table;
        layui.config({
            base: '../../layuiadmin/' //静态资源所在路径
        }).extend({
            index: 'lib/index' //主入口模块
            , qrcode: 'qrcode/qrcode'
        }).use(['index', 'table', 'form', 'qrcode'], function () {
            var $ = layui.$
                , form = layui.form
                , admin = layui.admin
                , table = layui.table;
            top.SetListPageLanguage(layui);

            $("#gotoSetApplication").click(function () {
                parent.layui.index.openTabsPage("/Referral/Application");
                //初始化导航选项卡（选中新建标签卡）
                parent.layui.element.render('nav');
            });

            //复制
            $('#copy').click(function () {
                var cont = $('#url').val();
                var tempInput = $("<input>");
                $("body").append(tempInput);
                tempInput.val(cont).select();
                document.execCommand("copy");
                tempInput.remove();
                top.ShowMessageByKey(layui, "copySuccess", 6, 5000);
            })

            //复制
            $('#showcopy').click(function () {
                var url = $('#url').val()
                var tempInput = $("<div style='overflow:auto;display:flex;align-items:center;justify-content:center;max-width: 100%;max-height: 100%'><div id='showqrcode' style='max-width: 100%;max-height: 100%;position: absolute;top: 50%;transform: translateY(-50%);'></div></div>");
                $("body").append(tempInput);
                $('#showqrcode').qrcode({
                    render: "canvas", //也可以替换为table
                    width: 200,
                    height: 200,
                    text: url
                });
                //弹出层
                layer.open({
                    type: 1,
                    shade: true,
                    shade: [0.4, '#000000'],
                    title: false, //不显示标题
                    area: ['70%', '70%'],
                    //maxWidt: 360,
                    //maxHeight: 360,
                    content: tempInput,
                    cancel: function () {
                        tempInput.remove();
                    }
                });
            })

            //一级客户数
            $('#onelevel').click(function () {
                top.OpenPageByKey(layui, "primaryCustomers", 2, '90%', '90%', '/Referral/LevelOneUser');
            })

            //二级客户数
            $('#towlevel').click(function () {
                top.OpenPageByKey(layui, "secondaryCustomers", 2, '90%', '90%', '/Referral/LevelTwoUser');
            })
        });
    </script>
}
    <div class="layui-fluid">
        <div class="layui-row layui-col-space10">
            <div class="layui-col-xs12 layui-col-md12">
                <div class="layui-card">
                    <div class="layui-card-header"><h2 lay-event="promotionOverview">推广概览</h2></div>
                    <div class="layui-card-body">
                        <div class="layui-row">
                            <div class="layui-col-xs6" id="onelevel">
                                <blockquote class="layui-elem-quote clent" style="background-color:transparent">
                                    <div lay-event="primaryCustomers">一级客户数</div>
                                    <div>@ViewBag.oneClients</div>
                                </blockquote>
                            </div>
                            <div class="layui-col-xs6" id="towlevel">
                                <blockquote class="layui-elem-quote clent" style="background-color:transparent">
                                    <div lay-event="secondaryCustomers">二级客户数</div>
                                    <div>@ViewBag.towClients</div>
                                </blockquote>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        @if (ViewBag.role == 1)
        {
            <div class="layui-col-xs12 layui-col-md12">
                <div class="layui-card">
                    <div class="layui-card-header"><h2 lay-event="promotionCenter">推广中心</h2></div>
                    <div class="layui-card-body">
                        <div class="layui-row">
                            <form class="layui-form layui-form-pane" action="">
                                @* <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
                            <legend lay-event="promotionLink">推广链接</legend>
                            </fieldset>*@
                                <div class="layui-row">
                                    <div class="layui-col-xs8">
                                        <label class="layui-form-label" lay-event="promotionLink">推广链接</label>
                                        <div class="layui-input-block">
                                            <input type="text" id="url" name="url" autocomplete="off" placeholder="" class="layui-input" value="@ViewBag.url">
                                        </div>
                                    </div>
                                    <div class="layui-col-xs2" style="text-align: center;line-height: 38px;">
                                        <label class="copy" lay-event="copylink" id="copy">复制邀请链接</label>
                                    </div>
                                    <div class="layui-col-xs2" style="text-align: center;line-height: 38px;">
                                        <label class="copy" lay-event="qrcode" id="showcopy">二维码</label>
                                    </div>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
        }
        else
        {
            <div class="layui-col-xs12 layui-col-md12">
                <div class="layui-card">
                    <div class="layui-card-body" style="text-align:center;">
                        <blockquote class="layui-elem-quote" id="setApplication" lay-event="setApplication">请先前往代理申请</blockquote>
                        <button type="button" class="layui-btn" id="gotoSetApplication" lay-event="gotoSetApplication">立即前往</button>
                    </div>
                </div>
            </div>
        }
    </div>
</div>